
/*
* pc 使用的姗格系统  element-ui的，同时也用到 DatePicker Button 等组件
* move 对应的组件使用 vant 组件库 DatePicker 等等
* 期望 所用组件并不多按需导入 减少依赖 首屏加载减少体积
* */

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import '@/env/rem.js'
// use vconsole log test
import('@/util/test-vconsole.js');
// add Date.prototype.Format function
import {Format, browserRedirect} from "@/util";
Format();
// import componentInstance from "./mixins/componentInstance";
// Vue.mixin(componentInstance)

import clearAxios from '@/mixins/delAxios'
Vue.mixin(clearAxios)

import echarts from "echarts";
window.echarts = echarts;

import completes from '@/components/index.js'
Vue.use(completes)

import http from '@/api'
Vue.prototype.$http = http;

//常用 全局组件
import {Toast} from 'vant';
import('vant/lib/index.css');

import {Button, Row,  Col, Message} from "element-ui";
import('element-ui/lib/theme-chalk/display.css')
import('element-ui/lib/theme-chalk/index.css')

Vue.use(Col)
Vue.use(Row)
Vue.use(Button)

/**
 *  轻提示 通用 手机 and 电脑
 * @param message
 * @param type { string } [ error | success ]
 */
Vue.prototype.$toast = function ({message, type}) {
    if(browserRedirect().isPc) {
        Message({
            message,
            type: type === undefined ? 'success' : type
        })
    } else {
        // let body = type === undefined ? message : {
        //     message,
        //     type: type === 'error' ? 'fail' : type,
        // }
        Toast(message);
    }
}

Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
